/**
 * 命名视图
 */

var routes = [
    {
        path: "/",
        components: {

            content :{
                template :`
                <div>
                    <h1>首页</h1>
                </div>
                `
            }
            
        }
    },
    {
        path: "/user",
        name: "user",
        components: {
            sidebar: {
                template :`
                <div>
                    <h2>用户管理</h2>
                    <h2>权限管理</h2>
                </div>
            `
            },
            
            content: {
                template :`
                <div>
                    阿斯达；发吧；是否会；按身高；施工方；复合肥；sf
                </div>
            `
            
            },
        },
        
    },
    {
        path: "/article",
        components :{
            sidebar: {
                template :`
                <div>
                <h2>帖子管理</h2>
                <h2>评论管理</h2>
            </div>
            `
            },
            
            content: {
                template :`
                <div>
                    阿斯达；发吧；是否会；按身高；施工方；复合肥；sf
                </div>
            `
            
            },
        }

    },
    
]
var vueRouter = new VueRouter({
    routes : routes
})

var app = new Vue({
    el : "#app",
    router : vueRouter,
    methods: {
        onClick: function(){
            setTimeout(function(){
                console.log(this)
                this.vueRouter.push('/about')
                setTimeout(function(){
                    console.log(this)
                    this.vueRouter.push({
                        path: "/user/王花花"
                    })
                    setTimeout(function(){
                        console.log(this)
                        this.vueRouter.push({
                            name: 'user',
                            params : {
                                name: "李栓蛋"
                            }
                        })
                    },2000)
                },2000)
            },2000)
        }
    }
})